<?php

class Html extends CHtml{
    public static function listData($models,$valueField,$textField,$nullField=false,$groupField='')
	{
		$listData=array();
                if($nullField){
                    $listData[NULL]='N/A';
                }
		if($groupField==='')
		{
			foreach($models as $model)
			{
				$value=self::value($model,$valueField);
				$text=self::value($model,$textField);
				$listData[$value]=$text;
			}
		}
		else
		{
			foreach($models as $model)
			{
				$group=self::value($model,$groupField);
				$value=self::value($model,$valueField);
				$text=self::value($model,$textField);
				$listData[$group][$value]=$text;
			}
		}
		return $listData;
	}
}
?>
